package cn.wolfcode.trip.base.domain;

import cn.wolfcode.trip.base.util.JSONUtil;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import lombok.Getter;
import lombok.Setter;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Setter
@Getter
@JsonIgnoreProperties("handler")
public class User extends BaseDomain {
    //邮箱
    private String email;
    //昵称
    private String nickName;
    //密码
    private String password;
    //地区
    private String place;
    //头像
    private String headImgUrl;
    //性别 -1 保密 0 女 1男
    private Integer gender;
    //背景
    private String coverImgUrl;
    //签名
    private String sign;
    //微信唯一标识
    private String openId;

    //系统通知
    private SystemNotice systemNotice;

    //手机号
    private String phone;

    //用户商品收藏
    private List<GoodsCollection> goodsCollection;


    //是否是会员
    private Boolean vip;

    //用于系统通知页面发送通知的json
    public String getJson(){
        Map<String,Object> map=new HashMap();
        map.put("id",id);
        if (systemNotice!=null) {
            map.put("content",systemNotice.getContent());
            map.put("systemNoticeId",systemNotice.getId());
        }
        map.put("phone",phone);
        return JSONUtil.toJSONString(map);
    }
}